package com.xce.product.controller;

import com.xce.product.entity.Product;
import com.xce.product.service.ProductService;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName ProductController
 * @Description TODO
 * @Author lld
 * @Date 2025/6/25 0:39
 * @Version 1.0
 */
@Slf4j
@RestController
public class ProductController {


    @Autowired
    private ProductService productService;

    @RequestMapping("/getProduct/{productId}")
    public Product getProduct(@PathVariable("productId") Long productId, HttpServletRequest request) {

        log.info("X-Token：【{}】",request.getHeader("X-Token"));
        return productService.getProduct(productId);
    }
}
